{include file="layout/header" title="代理审核列表" /}
	<div class="view-body">
    {include file="layout/menu" /}
		<div class="view-product">
			<div class="company_identify">
				<div class="manage-head">
					<h6 class="padding-left manage-head-con">代理审核</h6>
				</div>

				<div class="offcial-table tr-border table-margin clearfix">
					<div class="tr-th clearfix">
						<div class="th w10">ID</div>
						<div class="th w10">会员ID</div>
						<div class="th w10">用户名</div>
						<div class="th w10">姓名</div>
						<div class="th w15">身份证</div>
						<div class="th w10">销售顾问</div>
						<div class="th w15">时间</div>
						<div class="th w20">操作</div>
					</div>
						{volist name="list" id="v"}
						<div class="tr clearfix border-bottom-none">
							<div class="td w10">{$v.id}</div>
							<div class="td w10">{$v.user_id}</div>
							<div class="td w10">{$v.username}</div>
							<div class="td w10">{$v.realname}</div>
							<div class="td w15">{$v.identity}</div>
							<div class="td w10">{$v.invitename}</div>
							<div class="td w15">{:date('Y-m-d H:i:s',$v['time'])}</div>
							<div class="td w20">
								{if $v['status'] eq 0}
									<button data-apply_id="{$v.id}" class="layui-btn layui-btn-mini layui-btn-normal success">通过</button>
									<button data-apply_id="{$v.id}" class="layui-btn layui-btn-mini layui-btn-danger fail">拒绝</button>
								{/if}
							</div>
						</div>
						{/volist}
				</div>

				<div class="fl margin-top padding-big-left">
					
				</div>

				<div class="fr padding-big-right">
					<div class="page">
						{$list->render()}
					</div>
				</div>

			</div>
		</div>
	</div>
	<script type="text/javascript">
		new Form('form').init({$post});
	    layui.use(['form', 'layer'], function(){
			var $ = layui.jquery;
    		var layer = layui.layer;

    		$('.success').click(function() {
    			var apply_id = $(this).data('apply_id');
    			layer.confirm('确定审核通过', {
		            btn: ['确定', '取消'],
		            icon: 3
		        }, function(index) {
		            layer.close(index);
		            $.post('{:url("admin/User/examine")}', {id: apply_id,action:1}, function(res) {
		            	if(res.success == 1){
		            		layer.msg(res.msg, {
			                    time: 1000
			                }, function() {
			                	location.reload();
			                });
		            	}else{
		            		layer.msg(res.msg);
		            	}
		            });
		        });
		        return false;
    		});

    		$('.fail').click(function() {
    			var apply_id = $(this).data('apply_id');
    			layer.prompt({
				  	title: '请输入审核失败原因',
				}, function(value, index, elem){
				  	$.post('{:url("admin/User/examine")}', {id:apply_id,note:value,action:0}, function(res) {
		            	if(res.success == 1){
		            		layer.msg(res.msg, {
			                    time: 1000
			                }, function() {
			                    location.reload();
			                });
		            	}else{
		            		layer.msg(res.msg);
		            	}
		            },'json');
		            layer.close(index);
				});
		        return false;
    		});
		});
	</script>
{include file="layout/footer" /}
